<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" contentType="text/html;charset=UTF-8"%>
<div id="user_login_loginDialog" class="easyui-dialog" data-options="draggable:false,closable:false,iconCls:'icon-man',modal:true,title:'登陆',buttons:[
    {text:'登陆',iconCls:'icon-ok',handler:login},{text:'注册',iconCls:'icon-add',handler:gotoReg}]" >

    <form id="user_login_loginForm" method="post">
        <table>
            <tr>
                <td>登陆名 :</td>
                <td><input name="name" value="admin" class="easyui-validatebox" data-options="required:true,missingMessage:'请输入用户名',validType:['text','length[3,10]']"></td>
            </tr>
            <tr>
                <td>密 码 :</td>
                <td><input name="pwd" value="123456" class="easyui-validatebox" type="password" data-options="required:true,missingMessage:'请输入密码',validType:['text','length[3,10]']"></td>
            </tr>
        </table>

    </form>
</div>

<script>
    $(function(){
        $("#user_login_loginForm").form({
            url:"${pageContext.request.contextPath}/userAction!login.action",
            success:function(data){
                if($.parseJSON(data).success){
                    $("#user_login_loginDialog").dialog("close");;
                }
                $.messager.show({
                    title:'提示',
                    msg: $.parseJSON(data).msg
                });
            }});
        $("form input").bind("keyup",function(e){
            /*回车提交*/
            if(e.keyCode == '13'){
                var t = this;
                $("#user_login_loginForm").submit();
            }
        });

    });
    function login(){
        $("#user_login_loginForm").submit();
    }

</script>